<?php

namespace app\superadmin\controller;
use app\common\controller\SuperadminBase;
use app\superadmin\model\Images as Model;

use think\Controller;

use think\Db;

use think\Request;

use think\Session;



class Images extends SuperadminBase

{

    public function index()

    {
        if(\request()->isPost()){

            $data     = input('post.');

            //halt($data);

            if (isset($data['imgs'])) {
                 
                 $data['banner'] = json_encode($data['imgs']);
            }

            $good = Model::update($data, ['id'=>$data['id']], true);
            
            return 1;

        }else{

            $id       = 1;

            $info = Model::where('id',$id)->find();

            $info['banner'] = json_decode($info['banner'],true);

            $this->assign('info', $info);

            return $this->fetch();

        }
        

    }



}

